{include(head.tpl)}
<script>
    function changeImg()
    {
        document.getElementById("img1").src = "{ctlurl}/verify/id="+new Date();
    }
</script>
<body class="bg-wrap">
    <div class="container-fluid padding">
        <div class="bg animated fadeInDown">
            <div class="col-lg-4 col-lg-offset-4 login-wrap">
                <h3 class="text-center"><img src="{__STATIC__}/img/title.png" alt=""></h3>
                <form class="login-form form-horizontal col-lg-8 col-lg-offset-2">
                    <div class="form-group border">
                        <label class="control-label username"></label>
                        <div class="pull-left input-wrap">
                            <input type="text" name="username" value="" class="form-control name" placeholder="请输入用户名">
                        </div>
                    </div>
                    <div class="form-group border">
                        <label class="control-label password"></label>
                        <div class="pull-left input-wrap">
                            <input type="password"  name="password" value="" class="form-control pass" placeholder="请输入密码">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="pull-left input-wrap2">
                            <input type="text" name="code" value=""  class="form-control code" placeholder="">
                        </div>
                        <span class="yzm-tb dib text-center"><img src="{ctlurl}/verify" id="img1" onClick="changeImg()"></span>
                        <span class="hyz dib text-center" onclick="changeImg()">换一张</span>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-12 submit-wrap padding margin">
                            <button type="button" class="btn btn-block margin h_sub">登录</button>
                        </div>
                    </div>
                </form>
            </div>
            <div class="system-copyright col-lg-8 col-lg-offset-2 text-center">© 2017 奥科睿科技</div>
        </div>
    </div>
<script src="{__STATIC__}/js/jquery-1.10.2.min.js"></script>
<script src="{__STATIC__}/js/bootstrap.min.js"></script>
<script src="{__STATIC__}/js/common.js"></script>
<script src="{__STATIC__}/plugins/layer/layer.js"></script>
<script>
document.onkeydown=function(event){
   var e = event || window.event || arguments.callee.caller.arguments[0];
   if(e && e.keyCode==13){ // enter 键
        hsub();
   }
};
function hsub(){
  var username=$('.name').val();
  if($.trim(username)==''){
      layer.msg('用户名不能为空');
      return false;
  }
  var password=$('.pass').val();
  if($.trim(password)==''){
      layer.msg('密码不能为空');
      return false;
  }
  var code=$('.code').val();
  if($.trim(code)==''){
      layer.msg('验证码不能为空');
      return false;
  }
  _ajaxs.post('{ctlurl}/ajaxLogin','username='+username+'&password='+password+"&code="+code,function _return(hdata){
      if(hdata.status){
        window.location.href='{modelurl}/Index/index';
      }else{
        layer.msg(hdata.msg);
      }
  })
}
$(function(){
  $('.h_sub').click(function(){
      hsub();
  })
})
</script>
</body>
</html>
